<style>
    .cart-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        height: 10vh;
        width: 100vw;
        background: #ffffff;
        border-top: 1px solid #dfdfdf;
        border-bottom: 1px solid #dfdfdf;
    }

    .cart-footer div {
        display: inline-block;
        float: left;
    }

    .cft-left {
        width: 70%;
        height: 10vh;
        font-size: 1.6rem;
        line-height: 10vh;
        color: #ba3b3f;
    }

    .cft-right {
        width: 30%;
        height: 10vh;
        line-height: 10vh;
        font-size: 1.6rem;
        color: #ffffff;
        background: #b4282d;
    }
</style>
<div id="cart-footer" class="cart-footer">
    <div class="cft-left">
        应付:¥<span class="cft-price">{{number_format($cartInfo["price"],2)}}</span>
    </div>
    <div class="cft-right">
        去付款
    </div>
</div>
<script>
    $(".cft-right").on("click", function () {
        var isChecked = $(".angre").attr('checked');
        if (!isChecked)
            return false
        var address = $("#address-li").attr("data-address-id")
        if (!address) {
            alert("非法地址")
            return false
        }
        loading.show()
        $.post(
            "/api/add_order",
            {
                _token: csrf_token,
                price: $(".cft-price").text(),
                address: address,
            },
            function (e) {
                if (e.errorCode == 100) {
                    alert(e.errorMsg);
                    window.location.href = "/user/balance"
                } else if (e.errorCode == 0) {
                    window.location.href = "/order/pay/" + e.data.parent_order_id
                } else {
                    alert(e.errorMsg);
                    window.location.reload();
                }
                loading.hide()
            }, "json")
    })
</script>